let ResponseUtils = require("../utils/ResponseUtils");
let CityService = require("../service/city");

/**
 * 城市控制器
 */
class CityController {
    static async list(ctx) {
        let result = await CityService.list();
        ctx.body = ResponseUtils.builder(result).success().build();
    }

    static async create(ctx) {
        let result = await CityService.create(ctx.request.body);
        ctx.body = ResponseUtils.builder(result).success().build();
    }

    static async delete(ctx) {
        let id = ctx.params.id;
        let result = await CityService.delete(id);
        ctx.body = ResponseUtils.builder(result).success().build();
    }
}

module.exports = CityController;
